package com.ncloud.act.service.impl;

import java.util.List;

import javax.annotation.Resource;

import com.alibaba.dubbo.config.annotation.Service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ncloud.common.exception.UserException;
import com.ncloud.act.common.ActDataHelper;
import com.ncloud.act.entity.AccountDeposit;
import com.ncloud.act.mapper.AccountDepositMapper;
import com.ncloud.act.service.AccountDepositService;

@Service
public class AccountDepositServiceImpl implements AccountDepositService{
	@Resource
	private AccountDepositMapper mapper;
	
	public JSONArray getAccountDepositByAcctID(JSONObject json){
		if(!json.containsKey("acct_id"))
			throw new UserException("2001", "传入参数有误");
		Long acctID = json.getLong("acct_id");
		List<AccountDeposit> dicts = mapper.getAccountDepositByAcctID(acctID);
		JSONArray results=JSON.parseArray(JSON.toJSONString(dicts));
		ActDataHelper.div100(results, new String[] { "deposit_money","init_money", "invoice_money","print_money","freeze_money", "rsrv_money1" });
		return results;
	}
}
